package com.softer.chengxin.role.dao.provider;

import com.softer.chengxin.common.domin.Page;

import java.util.HashMap;

/**
 * @author Gong Zhiyang
 * @date 2018/10/18
 */
public class RoleDaoProvider {

    /**
     * 加载角色列表
     *
     * @param map
     * @return
     */
    public String load(HashMap<String, Object> map) {
        StringBuffer sql = new StringBuffer(20);
        Page page = (Page) map.get("page");
        sql.append("SELECT id ,roles_name as roleName,adder,DATE_FORMAT(addtime, '%Y-%m-%d') as addTime FROM roules");
        sql.append(" WHERE adder=#{loginName}");
        sql.append(" LIMIT ");
        sql.append(page.getBeginIndex()).append(",").append(page.getLimit());
        return sql.toString();
    }
}
